import pickle

class Cache:
    def __init__(self):
        self.map = {}

    def set(self, node):
        self.map[node.id] = node.signature

    def get(self, node):
        return self.map[node.id]

    def __eq__(self, other):
        return self.map == other.map

def save(cache, filename):
    with open(filename, 'wb') as f:
        pickle.dump(cache, f)

def load(filename):
    with open(filename, 'rb') as f:
        return pickle.load(f)

